﻿using System;

namespace MyCode.Project.Domain.Businesses.FileManager
{
    /// <summary>
    /// 文件项
    /// </summary>
    public class FileInfo
    {       
        /// <summary>
        /// 文件ID，修改时需要
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        /// 文件分组ID
        /// </summary>
        public Guid? GroupId { get; set; }

        /// <summary>
        /// 文件名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 文件路径
        /// </summary>
        public string Url { get; set; }

        /// <summary>
        /// 文件类型,1:图片,2:视频,3:文件
        /// </summary>
        public FileType FileType { get; set; }

        /// <summary>
        /// 文件大小，单位：Bit
        /// </summary>
        public int? Size { get; set; }

        /// <summary>
        /// 文件大小，单位：MB
        /// </summary>
        public double SizeMB
        {
            get
            {
                return Size==null ? 0 : Math.Round(Convert.ToDouble(Size / 1024d / 1024), 2);
            } 
        }

        /// <summary>
        /// 备注
        /// </summary>
        public string Note { get; set; }
    }
}
